/*
 Copyright To change this template, choose Tools | Templates
 Copyright and open the template in the editor.
 */

package com.click.app.dao.hibernate;

import com.click.app.dao.LaundryRequestDao;
import com.click.app.model.LaundryRequest;

import java.util.List;

/**
 * @author Joel Chuca Condo
 * @date 17/06/2009
 */
public class LaundryRequestDaoHibernate extends GenericDaoHibernate<LaundryRequest, Long> implements LaundryRequestDao{

    public LaundryRequestDaoHibernate(){
        super(LaundryRequest.class);
    }
    
    public List<LaundryRequest> getCurrentPeriodUnReception(){
        return getHibernateTemplate().find("from LaundryRequest as lr where lr.endDate=null and lr.payed=false");
    }

    public List<LaundryRequest> findRequestLaundryGT0ByPeriod(Long id) {
        return getHibernateTemplate().find("from LaundryRequest as lr where lr.periodPaymentLaundry.id=? " +
                                            " and lr.currentTotalPrice>0 ORDER BY lr.date ",id);
    }
}
